<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/jquery-3.4.1.js"></script>
    <style>
        body {
            background: #eefeff;
        }

        #loading {
            position: fixed;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #fff1ce
        }

        div>img {
            height: 200px;
            width: 300px;
        }
    </style>
</head>

<body>
    <div id="loading">
        <img src="images/7fd63efdcbbc9a91.jpg" alt="">
    </div>
    加载成功
    <script>
        var url = "https://easy-mock.com/mock/5d67436624fd60626abfe91e/ajax/base";
        /* ajax关注点
        1.请求的地址
        2.请求的方式 get,post
         */
        $.ajax({
            url: url,
            type: "get",
            dataType: "json",
            success: function(res){
                console.log(res),
                    $("#loading").hide()
            },
            fail: function (err) {
                console.log(err)
            },
            beforeSend: function () {
                console.log("数据正在加载中"),
                    $("#loading").show()
            }
        })
    </script>
</body>

</html>